package com.qpx.email.config;


import com.qpx.email.service.EmailService;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties(value = {EmailProperties.class})
@ConditionalOnClass(value = {EmailService.class})
public class EmailAutoConfig {



    @Bean
    @ConditionalOnProperty(prefix = "qpx.email",value = "isEmail",havingValue = "true")
    public EmailService emailService(){
        EmailService emailService = new EmailService();
        return emailService;
    }
}
